package bitcarve.hydra.ui.timeline.samples
{
	import bitcarve.hydra.core.time.TimePoint;
	import bitcarve.hydra.core.track.core.ITrack;
	import bitcarve.hydra.core.track.core.SampleTrack;
	
	public class TrackData
	{
		public static function createRandomColoredChildTracks(size:Number, root:ITrack):void
		{
			if(root == null) return;
			
			for( var i : Number = 0; i < size; i++ )
			{
				var color:uint = 0x999999 + randomInt(0x777777);
				root.addChildTrack(
					createSampleTracks(i, randomInt(200), randomInt(100), color)
					);
			} 
		}
		
		private static function createSampleTracks( i : Number, start : Number, length : Number, color : uint ) : ITrack
		{
			var track : SampleTrack = new SampleTrack("Track " + i,  start, start + length);
			track.color = color;
			return track;
		}
		
		private static function randomInt( max : Number ) : Number
		{
			return Math.floor( Math.random() * max );
		}
	}
}